package com.atguigu.servlet;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/servleta")
public class ServletA extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("servletA执行了");
        
        //获取参数
        String money = req.getParameter("money");
        System.out.println("moneya:"+money);
        
        // 请求转发给servletB

        //获取请求转发器
        //RequestDispatcher requestDispatcher = req.getRequestDispatcher("/servletb");
        RequestDispatcher requestDispatcher = req.getRequestDispatcher("a.html");
        //RequestDispatcher requestDispatcher = req.getRequestDispatcher("WEB-INF/b.html");


        //让请求转发器做出动作

        requestDispatcher.forward(req,resp);

    }
}
